package cn.dianhun.om.jpa.pojo;

import lombok.Data;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Objects;

/**
 * @author cyt
 * @create 2020-07-08 10:42
 */
@EntityListeners(AuditingEntityListener.class)
@Data
@Entity
@Table(name = "tb_user", schema = "renren", catalog = "")
public class TbUserEntity {
    @Id
    @Column(name = "user_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long userId;
    private String username;
    private String mobile;
    private String password;
    // @CreatedDate，
    @LastModifiedDate
    private Timestamp createTime;


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        TbUserEntity that = (TbUserEntity) o;
        return userId == that.userId &&
                Objects.equals(username, that.username) &&
                Objects.equals(mobile, that.mobile) &&
                Objects.equals(password, that.password) &&
                Objects.equals(createTime, that.createTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(userId, username, mobile, password, createTime);
    }
}
